import request from '@/utils/request'
import store from '../store'
export function fetchList(query) {
  return request({
    url: '/mall/ad/page',
    method: 'get',
    params: query
  })
}

export function delObj(id) {
  return request({
    url: '/mall/ad/id/' + id,
    method: 'delete'
  })
}

export function getObj(id) {
  return request({
    url: '/mall/ad/get/' + id,
    method: 'get'
  })
}
export function putObj(obj) {
  return request({
    url: '/mall/ad',
    method: 'put',
    data: obj
  })
}
export function addObj(obj) {
  return request({
    url: '/mall/ad',
    method: 'post',
    data: obj
  })
}
export async function uploadImg(fd) {
  return request({
    url: '/mall/ad/imgUpload',
    method: 'post',
    data: fd
  })
}

export function getToken() {
  return 'Bearer ' + store.getters.token
}

